<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>手写Promise-执行器函数处理异步行为</title>
    <script src="./index.js"></script>
</head>

<body>
    <script>
        const p1 = new Promise((resolve, reject) => {
            setTimeout(() => {
                // resolve(100);
                reject('error')
            }, 1000)
        })
        p1.then(value => {
            console.log(value);
        }, reason => {
            console.log(reason);
        });
        console.log(p1);
    </script>
</body>

</html>